<%--
  Created by IntelliJ IDEA.
  User: 钱多多的钱罐罐
  Date: 2022/3/16
  Time: 17:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%
        //post乱码：转化成utf-8
        request.setCharacterEncoding("utf-8");
        //获取用户名、密码、爱好
        String username=request.getParameter("username");
        String password=request.getParameter("password");

    %>
用户名：<%
    if (username!=null&&username.equals("")){
        %>
        <%=username%>
    }else{
    out.print("用户名未填写！")
    <%
    }
    %><br/>
密码：<%=password%><br/>
用户爱好：<%
        //获取表单复选框的值
        String[] hobbys = request.getParameterValues("hobby");
        if (hobbys!=null&&hobbys.length!=0) {
            //用户选择了爱好，将爱好获得
            for (String hobby:hobbys){
                out.print(hobby+"<br/>");
            }
        }else{
            out.print("您没有选择任何爱好");
        }
%><br/>
</body>
</html>
